package com.xdhl.fu.fim.xxljob.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 测试分布式任务
 *
 * @author 朱力维
 * @time 2022/6/11 16:20
 */
@Component
public class TestJob {

    private static final Logger log = LoggerFactory.getLogger(TestJob.class);

    public static void main(String[] args) {
        System.out.println(LocalDate.now().plusDays(14));
    }

    @XxlJob(value = "testJobHandler", init = "init", destroy = "destroy")
    public ReturnT<String> execute(String param) {
        log.info("test:" + LocalDateTime.now());
        return ReturnT.SUCCESS;
    }

    /**
     * 初始化方法
     */
    private void init() {
        log.info("init");
    }

    /**
     * 销毁方法
     */
    private void destroy() {
        log.info("destroy");
    }

}
